class CustomeTextInput extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <div>
                <input type="text" ref={this.props.inputRef} />
            </div>
        );
    }
}

class App extends React.Component {
    constructor(props) {
        super(props);
        this.inputElement = React.createRef();
        this.focusTextInput = this.focusTextInput.bind(this);
    }

    focusTextInput() {
        this.inputElement.current.focus();
    }

    render() {
        return (
            <div>
                <CustomeTextInput inputRef={this.inputElement} />
                <input type='button' value='Focus the input' onClick={this.focusTextInput} />
            </div>
        );
    }
}

ReactDOM.render(
    <App />,
    document.getElementById('root')
);